﻿<?php
define('IN_QY',true);
require("include/common.inc.php");	
require('getui/zsw1.php');

if($_GET['act']=='repass_do'){
	
			if($_POST["code"]){
		if($_COOKIE["code"]){
			if($_POST["code"]!=$_COOKIE["code"]){
				echo "<script type='text/javascript'>alert('验证码错误!');history.go(-1);</script>";
				exit;	
			}
		}else{
			echo "<script type='text/javascript'>alert('验证码错误!');history.go(-1);</script>";
				exit;
		}
	}else{
		echo "<script type='text/javascript'>alert('验证码错误!');history.go(-1);</script>";
			exit;	
	}
	if($rowi){
		echo "<script type='text/javascript'>alert('该手机号不存在!');history.go(-1);</script>";
		exit;
	}
		$dates=date('Y-m-d H:i:s',time());
		$xxxx = $_POST['userpwd'];
		$xx = $_POST['id'];
	$sql = "update tbl_user set userpwd= '".$xxxx."' , change_pwd_time='".$dates."' where userid = '".$xx."'";

	mysql_query($sql);
	    pushMessageToSingle_pwd_change($_COOKIE['userid']);
	echo "<script type='text/javascript'>alert('修改成功,请重新登录.');location.href='logout.php';</script>";
	exit;
}
?>
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>修改密码-众晒网</title>
    <link href="/ui/css/Hui.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
     #header{width:100%; position:absolute; top:0;}
     #footer{width:100%; height:55px; position:absolute; bottom:0;}	 
     #main{width:100%; overflow: auto; position:absolute; top:45px;bottom:0px;}
	.reto_code {
    position: relative;
    background-color: #fe984c;
    width: 8rem;
    text-align: center;
    display: block;
    padding: 5px;
    color: #fff;
    right: 0;
    font-size: 1rem;
    border-radius: 5px;
}
    </style>
    <script src="/ui/js/jquery.min.js"></script>
</head>
<body>
    <header class="H-header H-theme-background-color-white" id="header">
        <span tapmode="" onclick="H.closeWin();" class="H-icon H-position-relative H-display-inline-block H-float-left H-vertical-middle H-theme-font-color-white H-padding-horizontal-left-10 H-z-index-100"><i class="H-iconfont H-icon-arrow-left H-theme-font-color-black H-font-size-18 H-vertical-middle"></i></span>
        <div class="H-header-title H-center-all H-font-size-18 H-text-show-row-1 H-theme-font-color-black H-position-absolute H-width-100-percent H-font-weight-500">修改&忘记.密码</div>
    </header>

 <form action="?act=repass_do" method="post"  class="registerform"  name="form" onSubmit="return beforeSubmit(this);">
    <div id="main">
	 <div class="H-padding-vertical-bottom-10"></div>
     <div class="H-border-vertical-both-after">
        <div class="H-flexbox-horizontal H-border-vertical-bottom-margin-left-10-after">
            <span class="H-vertical-middle H-padding-horizontal-left-10 H-theme-background-color-white H-font-size-16">手机号:</span><input type="text" id="userid" value="" name="id" class="H-textbox H-vertical-align-middle H-vertical-middle H-font-size-12 H-flex-item H-box-sizing-border-box H-border-none H-outline-none H-padding-12" placeholder="输入注册时的手机号" />
        </div>
        <div class="H-flexbox-horizontal H-border-vertical-bottom-margin-left-10-after">
            <span class="H-vertical-middle H-padding-horizontal-left-10 H-theme-background-color-white H-font-size-16">新密码:</span><input type="password"  id="userpwd" value="" name="userpwd" placeholder="请输入新密码" datatype="*6-16" nullmsg="请设置新密码！" errormsg="密码范围在6~16位之间！" class="H-textbox H-vertical-align-middle H-vertical-middle H-font-size-12 H-flex-item H-box-sizing-border-box H-border-none H-outline-none H-padding-12"/>
        </div>
		 <div class="H-flexbox-horizontal">
            <span class="H-icon H-vertical-middle H-padding-horizontal-left-10 H-theme-background-color-white">
			验证码:
			</span><input type="text" id="code" value="" name="code" class="H-textbox H-vertical-align-middle H-vertical-middle H-font-size-11 H-flex-item H-box-sizing-border-box H-border-none H-outline-none H-padding-12" placeholder="输入验证码" /><span class="H-vertical-middle H-padding-horizontal-right-10 H-theme-background-color-white H-theme-font-color1 H-font-size-12">
			<input type="button"  class="reto_code"  id="send_code"   value="获取验证码" name="phone" onclick="showtime(60)"></span>
        </div>
<div class="Validform_checktip"></div>
    </div>

<div style="margin-top:20px">
    <center>
    <button class="H-button H-width-100-percent  H-font-size-15 H-outline-none H-theme-background-color-transparent H-padding-vertical-both-8 H-padding-horizontal-both-20 H-theme-font-color8 H-theme-border-color8 H-theme-border-color8-click H-theme-background-color8-click H-theme-font-color8-click H-border-radius-3" style="width:80%">确定修改</button>
    </center>
        </div>
    </div>

    </form> 

     <!--################################底部开始################################-->  	
    <?include('footer.php');?>
     <!--################################底部结束################################-->
    <script src="/ui/script/H.js" type="text/javascript"></script>
	<script type='text/javascript' src='/wap/dl/zc/js/LocalResizeIMG.js'></script>
	<script type='text/javascript' src='/wap/dl/zc/js/patch/mobileBUGFix.mini.js'></script>
    <script type="text/javascript" src="/wap/dl/zc/js/jquery.flexslider-min.js"></script>
    <script type="text/javascript" src="/ui/layer/mobile/layer.js"></script>  
<script type="text/javascript">

function beforeSubmit(form){
if(form.id.value==''){
   layer.open({
    content: '手机号不能为空！'
    ,skin: 'msg'
    ,time: 4 //2秒后自动关闭
  });
return false;

}

if(form.userpwd.value==''){
	
   layer.open({
    content: '密码不能为空！'
    ,skin: 'msg'
    ,time: 4 //2秒后自动关闭
  });


return false;

}

if(form.code.value==''){
   layer.open({
    content: '请输入验证码！'
    ,skin: 'msg'
    ,time: 4 //2秒后自动关闭
  });


return false;

}

return true;

}

</script> 

	
<script>

function showtime(t){


}

var flag = 1;  
var i = 55;  
function countDown() {  

 var div = document.getElementById("send_code");
    i = i - 1;  
	 div.style.setProperty('background-color','#cccccc');	
	$("#send_code").attr("disabled","disabled");
    $("#send_code").val(i+"秒后重新发送");  
	
    if (i == 0) {  
	 div.style.setProperty('background-color','#fe984c');
	 
	$("#send_code").removeAttr("disabled");;
        $("#send_code").val("重新发送");  
        flag = 1;  
        i = 55;  
        return;  
    }  
    setTimeout('countDown()',1000);  
} 

function update_p(num,t) {
	if(num == t) {
		document.myform.phone.value =" 重新发送 ";
		document.myform.phone.disabled=false;
	}
	else {
		printnr = t-num;
		document.myform.phone.value = " (" + printnr +")秒后重发";
	}
}

</script>

<script type="text/javascript">

var daojs =60;

$(function(){

	$('#send_code').click(function(){

		var phone = $('#userid').val();

		if(phone==''){
             layer.open({
    content: '请输入您的手机号码！'
    ,skin: 'msg'
    ,time: 4 //2秒后自动关闭
  });
  return false;
		}else{

			$.ajax({

			type: "POST",

			url: "sms_send.php",

			data: {phone:phone},

			dataType: "json",

			success: function (data) {
				if (data.error==1) {
             layer.open({
    content: '短信发送成功'
    ,skin: 'msg'
    ,time: 4 //2秒后自动关闭
  });
  
  
  countDown();
  

				} else {

                    alert(data);
					alert('短信发送错误，请联系客服!');

				}

			}

			});

		}

	});

})

function daoJiShi(){

	if(daojs>0){

		$('#send_code').val("发送成功("+daojs+")");

		daojs--;

		setTimeout('daoJiShi()',1000);

		$('#send_code').attr("disabled","disabled")

	}else{

		$('#send_code').val('重新发送');

		 $("#send_code").removeAttr("disabled");

		 return daojs=60;

	}

	return false;

}

</script>
</body>
</html>